import './TableSelect.scss'
import { useMount } from 'ahooks'
import { lazy, useState } from 'react'

const TableSelect = ({ data, Off }) => {
    const { type, init } = data
    const [TableTemp, setTableTemp] = useState(null)

    useMount(() => {
        const tableTemp = lazy(() => import(`../view/${type}.jsx`))
        setTableTemp(tableTemp)
    })

    return (
        <div className='TableSelect'>
            {TableTemp && <TableTemp init={init} Off={Off} />}
        </div>
    )
}

export default TableSelect;